﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Collections;
using Castle.DynamicProxy;

namespace DynamicProxyStudy
{
    static class Program
    {
        /// <summary>
        /// 全局权限信息
        /// </summary>
        public static IDictionary DIC;


        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            //从配置文件读取权限信息
            DIC = (IDictionary)System.Configuration.ConfigurationManager.GetSection("PopedomControlList");

            
            //string[] keys = new string[dir.Keys.Count];
            //string[] values = new string[dir.Keys.Count];
            //dir.Keys.CopyTo(keys, 0);
            //dir.Values.CopyTo(values, 0);
            //for (int i = 0; i < keys.Length; i++)
            //{
            //    PopedomList.Add(keys[i], values[i]);
            //}
            try
            {
                ProxyGenerator gen = new ProxyGenerator();
                MainForm frm = (MainForm)gen.CreateClassProxy(typeof(MainForm), new MyInterceptor());

                //Application.EnableVisualStyles();
                //Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(frm);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
            }

        }
    }
}
